<style>
    .user_check_big {
        margin-left: 15px;
    }

    .modal_fixed {
        display: none;
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        margin: auto;
        background-color: rgba(0, 0, 0, .5);
        overflow: auto;
    }

    .window_frame_img {
        position: absolute;
        /*padding: 5px;*/
        left: 50%;
        top: 50%;
    }

    .window_frame_img img {
        display: block;
        background-color: #fff;

        /*margin: auto;*/
    }

    .modal_close {
        position: absolute;
        right: -10px;
        top: -10px;
        height: 20px;
        width: 20px;
        background: url(/statics/image/modal_close.png) no-repeat center center;
    }
</style>
<div class="box box-solid">
    <div class="box-body table-responsive no-padding">
        <form role="form" action="#" method="post">
            <input type="hidden" name="user[user_sid]" value="<?php echo $user['user_id']; ?>"/>
            <div class="box-body">


                <?php if ($user['type'] == 1): ?>

                    <div class="form-group">
                        <label>货主姓名</label>
                        <input type="text" name='user[name]' class="form-control" maxlength="20"
                               value="<?php echo $user['name']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>昵称</label>
                        <input type="text" name='user[nickname]' readonly="" class="form-control" maxlength="20"
                               value="<?php echo $user['nickname']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>性别</label>
                        <div class="controls">
                            <select name='user[gender]' readonly class="form-control  name">
                                <option <?php if (!empty($user['gender']) && $user['gender'] == 1) echo 'selected' ?>
                                        value="1">男
                                </option>
                                <option <?php if (!empty($user['gender']) && $user['gender'] == 2) echo 'selected' ?>
                                        value="2">女
                                </option>
                                <option <?php if ($user['gender'] != 1 && $user['gender'] != 2) echo 'selected' ?>
                                        value="3">未知
                                </option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label>身份证号</label>
                        <input type="text" name='user[idcard]' class="form-control" maxlength="20"
                               value="<?php echo $user['idcard']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>手持身份证照</label>
                        <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_photo'], 300, 300) ?>"/>
                        <a href="javascript:;" class="user_check_big">查看大图</a>
                        <div class="modal_fixed">
                            <div class="window_frame_img">
                                <span class="modal_close"></span>
                                <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_photo']) ?>" alt="">
                            </div>
                        </div>
                        <p class="help-blockk"></p>
                    </div>
                    <input type="hidden" name='user[idcard_photo]' value="<?php echo $user['idcard_photo']; ?>"/>

                    <div class="form-group">
                        <label>身份证人像照</label>
                        <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_reverse'], 300, 300) ?>"/>
                        <a href="javascript:;" class="user_check_big">查看大图</a>
                        <div class="modal_fixed">
                            <div class="window_frame_img">
                                <span class="modal_close"></span>
                                <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_reverse']) ?>" alt="">
                            </div>
                        </div>
                        <p class="help-blockk"></p>
                    </div>
                    <input type="hidden" name='user[idcard_reverse]' value="<?php echo $user['idcard_reverse']; ?>"/>

                    <div class="form-group">
                        <label>身份证背面照</label>
                        <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_positive'], 300, 300) ?>"/>
                        <a href="javascript:;" class="user_check_big">查看大图</a>
                        <div class="modal_fixed">
                            <div class="window_frame_img">
                                <span class="modal_close"></span>
                                <img src="<?php echo WxUtil::getGoodsImgUrl($user['idcard_positive']) ?>" alt="">
                            </div>
                        </div>
                        <p class="help-blockk"></p>
                    </div>
                    <input type="hidden" name='user[idcard_positive]' value="<?php echo $user['idcard_positive']; ?>"/>

                <?php endif; ?>

                <?php if ($user['type'] == 2): ?>
                    <div class="form-group">
                        <label>企业名称</label>
                        <input type="text" readonly name='user[enterprise]' class="form-control" maxlength="20"
                               value="<?php echo $user['enterprise']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>企业简称</label>
                        <input type="text" readonly name='user[abbreviation]' class="form-control" maxlength="20"
                               value="<?php echo $user['abbreviation']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>联系人</label>
                        <input type="text" readonly name='user[link_man]' class="form-control" maxlength="20"
                               value="<?php echo $user['link_man']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>联系方式</label>
                        <input type="text" readonly name='user[link_way]' class="form-control" maxlength="20"
                               value="<?php echo $user['link_way']; ?>">
                        <p class="help-blockk"></p>
                    </div>

                    <div class="form-group">
                        <label>营业执照</label>
                        <div>
                            <img src="<?php echo WxUtil::getGoodsImgUrl($user['business_license'], 300, 300) ?>"/>
                            <a href="javascript:;" class="user_check_big">查看大图</a>
                            <div class="modal_fixed">
                                <div class="window_frame_img">
                                    <span class="modal_close"></span>
                                    <img src="<?php echo WxUtil::getGoodsImgUrl($user['business_license']) ?>" alt="">
                                </div>
                            </div>
                        </div>
                        <p class="help-blockk"></p>
                        <input type="hidden" name='user[business_license]'
                               value="<?php echo $user['business_license']; ?>"/>
                    </div>


                <?php endif; ?>


                <div class="box-footer">
                    <?php if ($user['status'] == 1): ?>
                        <button class="btn btn-primary" type="submit">认证成功</button>
                        <a href="<?php echo $this->createUrl('user/carryrefused/id/' . Yii::app()->request->getQuery('id')); ?>">驳回认证</a>
                    <?php endif; ?>
                    <a href="<?php echo $this->createUrl('user/applylist/sid/' . $user['user_id']); ?>">返回申请列表</a>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(function () {
        $('.user_check_big').click(function () {
            var frame = $(this).siblings('.modal_fixed');
            frame.show();
            var show_frame = frame.find('.window_frame_img');
            var max_oh = document.documentElement.clientHeight;
            var max_ow = document.documentElement.clientWidth;
            var oh = show_frame.find('img').height();
            var ow = show_frame.find('img').width();

            var m_w, m_h;
            if (oh < max_oh && ow < max_ow) {

                if(Math.abs(oh-max_oh) < 50){
                    m_h=0.8*max_oh;
                }else {
                    m_h = oh;
                }
                m_w=ow;



            } else {
                if (ow > max_ow) {

                    m_w = max_ow * 0.9;

                    if (oh * (m_w / ow) > max_oh) {
                        m_h = max_oh;
                    } else {
                        m_h = oh * (m_w / ow);
                    }
                } else if (oh > max_oh) {

                    m_h = max_oh * 0.9;
                    if (ow * (m_h / oh) > max_ow) {
                        m_w=max_ow;
                    } else {
                        m_w = ow * (m_h / oh);
                    }
                }
            }

            show_frame.css({
                'margin-top': -m_h / 2 + 'px',
                'margin-left': -m_w / 2 + 'px',
                'height': m_h + 'px',
                'width': m_w + 'px'

            }).find('img').css({
//                'height':m_h+'px',
                'width': m_w + 'px'
            });
        });

        $('.modal_close').click(function () {
            $('.modal_fixed').hide();
        })
    });
</script>